$OpenBSD: patch-configure,v 1.49 2015/07/26 07:22:15 ajacoutot Exp $
--- configure.orig	Thu Jul 23 19:37:50 2015
+++ configure	Thu Jul 23 19:43:44 2015
@@ -4204,7 +4204,7 @@ case $target_os in
     openbsd|bitrig)
         disable symver
         SHFLAGS='-shared'
-        SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
+        SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBVERSION)'
         SLIB_INSTALL_LINKS=
         oss_indev_extralibs="-lossaudio"
         oss_outdev_extralibs="-lossaudio"
@@ -4555,7 +4555,7 @@ die_license_disabled version3 libvo_amrwbenc
 
 enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
 
-disabled optimizations || check_cflags -fomit-frame-pointer
+enabled x86_32 && check_cflags -fomit-frame-pointer
 
 enable_weak_pic() {
     disabled pic && return
@@ -5394,7 +5394,9 @@ check_disable_warning -Wno-pointer-sign
 check_ldflags -Wl,--warn-common
 check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
 enabled rpath && add_ldexeflags -Wl,-rpath,$libdir
-test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
+if ! enabled mips; then
+    test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
+fi
 
 # add some strip flags
 # -wN '..@*' is more selective than -x, but not available everywhere.
@@ -5600,6 +5602,11 @@ if test $target_os = "haiku"; then
     disable posix_memalign
 fi
 
+
+if test $target_os = "openbsd"; then
+    enabled x86_32 && disable ebx_available
+fi
+
 enabled_all dxva2 dxva2api_cobj CoTaskMemFree &&
     prepend ffmpeg_libs $($ldflags_filter "-lole32" "-luser32") &&
     enable dxva2_lib
@@ -6025,8 +6032,8 @@ pkgconfig_generate(){
     comment=$2
     version=$3
     libs=$4
-    requires=$(map 'lib_version $v' $(eval echo \$${name#lib}_deps))
-    requires=${requires%, }
+    requires=$5
+    linkflags=$6
     enabled ${name#lib} || return 0
     mkdir -p $name
     cat <<EOF > $name/$name${build_suffix}.pc
@@ -6041,7 +6048,7 @@ Version: $version
 Requires: $(enabled shared || echo $requires)
 Requires.private: $(enabled shared && echo $requires)
 Conflicts:
-Libs: -L\${libdir} $(enabled rpath && echo "-Wl,-rpath,\${libdir}") -l${shortname} $(enabled shared || echo $libs)
+Libs: -L\${libdir} $(enabled rpath && echo "-Wl,-rpath,\${libdir}") -l${shortname} $(enabled shared || echo $libs) $linkflags
 Libs.private: $(enabled shared && echo $libs)
 Cflags: -I\${includedir}
 EOF
@@ -6065,12 +6072,12 @@ Cflags: -I\${includedir}
 EOF
 }
 
-pkgconfig_generate libavutil     "FFmpeg utility library"               "$LIBAVUTIL_VERSION"     "$LIBRT $LIBM"
-pkgconfig_generate libavcodec    "FFmpeg codec library"                 "$LIBAVCODEC_VERSION"    "$extralibs"
-pkgconfig_generate libavformat   "FFmpeg container format library"      "$LIBAVFORMAT_VERSION"   "$extralibs"
-pkgconfig_generate libavdevice   "FFmpeg device handling library"       "$LIBAVDEVICE_VERSION"   "$extralibs"
-pkgconfig_generate libavfilter   "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION"   "$extralibs"
-pkgconfig_generate libpostproc   "FFmpeg postprocessing library"        "$LIBPOSTPROC_VERSION"   ""
-pkgconfig_generate libavresample "Libav audio resampling library"       "$LIBAVRESAMPLE_VERSION" "$LIBM"
-pkgconfig_generate libswscale    "FFmpeg image rescaling library"       "$LIBSWSCALE_VERSION"    "$LIBM"
-pkgconfig_generate libswresample "FFmpeg audio resampling library"      "$LIBSWRESAMPLE_VERSION" "$LIBM"
+pkgconfig_generate libavutil     "FFmpeg utility library"               "$LIBAVUTIL_VERSION"     "$LIBavutil_EXTRALIBS"     "$LIBavutil_REQUIRES"     "$LIBavutil_LINKFLAGS"
+pkgconfig_generate libavcodec    "FFmpeg codec library"                 "$LIBAVCODEC_VERSION"    "$LIBavcodec_EXTRALIBS"    "$LIBavcodec_REQUIRES"    "$LIBavcodec_LINKFLAGS"
+pkgconfig_generate libavformat   "FFmpeg container format library"      "$LIBAVFORMAT_VERSION"   "$LIBavformat_EXTRALIBS"   "$LIBavformat_REQUIRES"   "$LIBavformat_LINKFLAGS"
+pkgconfig_generate libavdevice   "FFmpeg device handling library"       "$LIBAVDEVICE_VERSION"   "$LIBavdevice_EXTRALIBS"   "$LIBavdevice_REQUIRES"   "$LIBavdevice_LINKFLAGS"
+pkgconfig_generate libavfilter   "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION"   "$LIBavfilter_EXTRALIBS"   "$LIBavfilter_REQUIRES"   "$LIBavfilter_LINKFLAGS"
+pkgconfig_generate libpostproc   "FFmpeg postprocessing library"        "$LIBPOSTPROC_VERSION"   "$LIBpostproc_EXTRALIBS"   "$LIBpostproc_REQUIRES"   "$LIBpostproc_LINKFLAGS"
+pkgconfig_generate libavresample "Libav audio resampling library"       "$LIBAVRESAMPLE_VERSION" "$LIBreavsample_EXTRALIBS" "$LIBavresample_REQUIRES" "$LIBavresample_LINKFLAGS"
+pkgconfig_generate libswscale    "FFmpeg image rescaling library"       "$LIBSWSCALE_VERSION"    "$LIBswscale_EXTRALIBS"    "$LIBswscale_REQUIRES"    "$LIBswscale_LINKFLAGS"
+pkgconfig_generate libswresample "FFmpeg audio rescaling library"       "$LIBSWRESAMPLE_VERSION" "$LIBswresample_EXTRALIBS" "$LIBswresample_REQUIRES" "$LIBswresample_LINKFLAGS"
